<template>
  <router-view />
  <van-tabbar route>
    <van-tabbar-item replace to="/home" icon="home-o"> 首页 </van-tabbar-item>
    <van-tabbar-item replace to="/article" icon="description">
      文章
    </van-tabbar-item>
    <!-- needtodo -->
    <!-- <van-tabbar-item replace to="/explore" name="setting" icon="fire-o"
      >发现</van-tabbar-item
    > -->
    <van-tabbar-item replace name="setting" icon="fire-o">发现</van-tabbar-item>
    <!-- 登录用户 -->
    <van-tabbar-item replace to="/user" icon="user-o" v-if="loginMk">
      用户
    </van-tabbar-item>
    <van-tabbar-item replace to="/more" icon="ellipsis" v-if="!loginMk">
      其他
    </van-tabbar-item>
  </van-tabbar>
</template>
<script lang="ts" setup>
import { User, Wap } from "../../common/wap";
import { onMounted, ref } from "vue";


const loginMk = ref(false);

onMounted(function () {
  new User({
    onData() {
      loginMk.value = this.isLogin;
      if (!this.isLogin) {
        // 用户自动登录，用户未登录时
        Wap.loginRememberHash(() => {
          location.reload();
        });
      }
    },
  })
});
</script>
